const mongoose = require('mongoose')
const { dbHost } = require('../../conf/index')
mongoose.connect(`mongodb://${dbHost}/music_db`)

const Schema = mongoose.Schema

const uploadSchema = new Schema({
  fileName: { required: true, type: String },
  filePath: { required: true, type: String },
  uploadTime: { type: Date, default: new Date() },
  ext: { type: String }
})

module.exports = mongoose.model('upload_file', uploadSchema)
// first.save().then(
//   data => console.log(data),
//   err => console.log('shibai')
// )
// Shoplist.find({$or:[{goods_price:{$lt:200}}]},{id:true,_id:false}).limit(10)
//     .then((data) => console.log(data),
//         (err) => console.log('shibai'))
// let word = '简餐'
// Shoplist.find({ $or: [{ category: eval('/' + word + '/') }, { address: '隆回万达' }] }).then(
//   data => console.log(data),
//   err => console.log('shibai')
// )
// Shoplist.updateOne({ _id: '61baed7528360c4fa16aed6b' }, { id: 11 })
//     .then(value => console.log('chenggong'), reason => console.log('shibai'))
// Shoplist.deleteOne({ _id: '61e65a6393db8e2149474020' }).then(
//   data => console.log('chenggong'),
//   err => console.log('shibai')
// )
